/*
* @Author: jingyu.ma
* @Date:   2017-08-02 18:54:08
* @Last Modified by:   jingyu.ma
* @Last Modified time: 2017-08-12 18:14:07
*/

import React from 'react';
import { connect } from 'react-redux';
import { addUserMobile } from 'action/app';
import 'css/components/judgeMobile.less';

class judgeMobile extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            mobile:''
        }
    }
    changeMobile(e){
        this.setState(Object.assign({},this.state,{
            mobile: e.target.value
        }))
    }
    addMobile(){
        let data ={
            mobile: this.state.mobile
        }
        this.props.dispatch(addUserMobile(data));
    }
    render(){
        return(
            <div className="mobile-blok">
                <div className="judge-mobile">
                    <div className="mobile-info">
                        <input type="number" className="mobile" value={this.state.mobile
                        } onChange={(e)=>{this.changeMobile(e)}}/>
                    </div>
                    <div className="confirm" onClick={()=>{this.addMobile()}}>
                        确定
                    </div>
                </div>
            </div>
        )
    }
}
const judgeMobileData = (state) =>{
    return  {
        app:state.app
    }
}
let visibileJudgeMobile = connect(judgeMobileData)(judgeMobile);
export default visibileJudgeMobile;